package com.example.shop_2207.fragment

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.example.shop_2207.entity.ResultEntity
import com.example.shop_2207.mvvm.BaseViewModel
import kotlinx.coroutines.launch
import okhttp3.MultipartBody

class MineViewModel:BaseViewModel() {
    val iconSuccess = MutableLiveData<ResultEntity>()
    val iconFail = MutableLiveData<String>()
    fun updateIcon(part: MultipartBody.Part){
        viewModelScope.launch {
            try {
                val result = apiServer.updateIcon(part)
                iconSuccess.value = result
            }catch (e:Exception){
                iconFail.value = e.message
            }
        }
    }
}